/**
 * @typedef DeleteIdsBody
 * @property {string[]} ids.required
 */

const express = require('express')
const router = express.Router()
const auth = require('@/middleware/auth.middleware')
const dynamicController = require('@/controllers/dynamic.controller')

/**
 * 动态列表分页查询
 * @route GET /dynamic
 * @summary 动态列表分页查询
 * @group 动态管理
 * @param {string} pageNo.query.required
 * @param {string} pageSize.query.required
 * @param {string} nickname.query 所属用户昵称
 * @param {enum} type.query 动态类型 1 发布， 2 点赞， 3 关注， 4 收藏 - eg: 1, 2, 3, 4
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access user-dynamic-manage-permission:btn:find
 * @security JWT
 */
router.get('/', auth(), dynamicController.findPage)

/**
 * 批量删除动态
 * @route DELETE /dynamic
 * @summary 批量删除动态
 * @group 动态管理
 * @param {DeleteIdsBody.model} DeleteIdsBody.body.required 动态类型
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access user-dynamic-manage-permission:btn:delete
 * @security JWT
 */
router.delete('/', auth(), dynamicController.batchDeleteByIds)

module.exports = router
